package zheezes.jui;

import java.net.URL;

import javax.swing.ImageIcon;

import org.apache.log4j.Logger;

/**
 * @author hcconquer@gmail.com
 * @create 2013-01-29
 */
public class ResMgr {
	public final static Logger log = Logger.getLogger(JMail.class);
	
	public final static String APP_NAME = "JMail";
	public final static String VERSION = "1.0.0";
	public final static String AUTHOR = "hcconquer@gmail.com";

	public final static String IMAGE_JMAIL = "jmail.png";
	public final static String IMAGE_SAVE = "save.png";
	public final static String IMAGE_ADD = "add.png";
	public final static String IMAGE_REMOVE = "remove.png";
	public final static String IMAGE_START = "start.png";

	public static URL get(String name) {
		URL url = ResMgr.class.getResource("/image/" + name);
		log.debug(String.format("%s: %s", name, url));
		return url;
	}

	public static ImageIcon getIcon(String name) {
		URL url = get(name);
		if (url == null) {
			return null;
		}
		return new ImageIcon(url);
	}
}
